import { PanelDataProvider, PanelItemProvider } from '../../../interface';
import { PanelData } from '../../panel-data';

/**
 * 应用菜单
 *
 * @author chitanda
 * @date 2022-02-17 15:02:43
 * @export
 * @class AppMenuProvider
 * @implements {PanelItemProvider}
 */
export class AppMenuProvider implements PanelItemProvider {
  type = 'APPMENU';

  materialGroup = 'xxx';

  materialComponent = 'app-menu-material';

  contentComponent = 'app-menu-content';

  async createItem(parent: PanelDataProvider | null): Promise<PanelDataProvider> {
    console.log(parent, '新建应用菜单');
    return new PanelData({
      psapppvparts: null,
      psappmenuname: 'Main',
      psappportalviewname: 'AppPortalView',
      updateman: 'test_0805_001',
      psappmenuid: 'e9961522de7c3fb96c9e53f76b3eba6e',
      pssystemid: '2C40DFCD-0DF5-47BF-91A5-C45F810B0001',
      createdate: '2022-02-17 14:40:02',
      title: '首页菜单',
      colspan: 1,
      ordervalue: 100,
      ppsapppvpartid: parent?.id,
      createman: 'test_0805_001',
      updatedate: '2022-02-17 14:40:02',
      validflag: 1,
      psapppvpartname: 'appmenu1-' + new Date().getTime(),
      ppsapppvpartname: 'container3',
      psapppvpartid: new Date().getTime(),
      colid: 0,
      pvparttype: 'APPMENU',
      psappportalviewid: '3DEFA381-5219-4670-9300-BB191266044D',
    });
  }

  async moveItem(
    from: PanelDataProvider<unknown>,
    to: PanelDataProvider<unknown>,
    item: PanelDataProvider<unknown>,
  ): Promise<boolean> {
    console.log(from, to, item, '移动应用菜单');
    return true;
  }

  removeItem(item: PanelDataProvider<unknown>): Promise<boolean> {
    throw new Error('Method not implemented.');
  }
}
